/*
 * @Date: 2023-04-26 16:31:34
 * @Description:
 * @LastEditors: hujingyang
 * @Author: hujingyang
 * @FilePath: \largeScreenDataVisualization\src\service\request\interface.types.ts
 * @IDE: Created by VScode.
 */

import type { AxiosRequestConfig, AxiosResponse } from "axios";

export interface HJYAxiosResponse extends AxiosResponse {
  config: HJYAxiosRequestConfig;
}

export interface HJYAxiosRequestConfig extends AxiosRequestConfig<any> {
  pageName?: string;
}

export interface HJYRequestInterceptors<T = HJYAxiosResponse> {
  requestInterceptor?: (
    config: HJYRequestConfigAddHeaders
  ) => HJYRequestConfigAddHeaders;
  requestInterceptorCatch?: (error: any) => any;
  responseInterceptor?: (config: T) => T;
  responseInterceptorCatch?: (error: any) => any;
}

export interface HJYRequestConfigAddHeaders extends AxiosRequestConfig {
  headers?: any;
}

export interface HJYRequestConfig<T = AxiosResponse>
  extends AxiosRequestConfig {
  interceptors?: HJYRequestInterceptors<T>;
  showLoading?: boolean;
}

export interface obtainDataType {
  params?: { [x: string]: any };
  url: string[];
  data?: { [x: string]: any };
  showLoading?: boolean;
  interceptors?: HJYRequestInterceptors;
  pageName?: string;
}
